package cn.iocoder.yudao.module.system.controller.admin.queryscene.vo;

import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.map.MapUtil;
import cn.iocoder.yudao.framework.mybatis.core.enums.QueryFieldType;
import lombok.Data;

import java.util.List;
import java.util.Map;

/**
 * 线索构建条件
 */
@Data
public class CrmClueCondition extends QuerySceneBaseVO{

    public static List<QuerySceneBaseVO> buildList(Map<Object, Object> userIdNameList) {
        return ListUtil.toList(
                new CrmClueCondition().setField("name").setFieldName("线索名称").setQueryType(buildDefaultQueryType()).setFieldType(QueryFieldType.INPUT),
                new CrmClueCondition().setField("mobile").setFieldName("手机号").setQueryType(buildDefaultQueryType()).setFieldType(QueryFieldType.INPUT),
                new CrmClueCondition().setField("telephone").setFieldName("电话").setQueryType(buildDefaultQueryType()).setFieldType(QueryFieldType.INPUT),
                new CrmClueCondition().setField("wechat").setFieldName("微信号").setQueryType(buildDefaultQueryType()).setFieldType(QueryFieldType.INPUT),
                new CrmClueCondition().setField("qq").setFieldName("QQ号").setQueryType(buildDefaultQueryType()).setFieldType(QueryFieldType.INPUT),
                new CrmClueCondition().setField("email").setFieldName("邮箱").setQueryType(buildDefaultQueryType()).setFieldType(QueryFieldType.INPUT),
                new CrmClueCondition().setField("remark").setFieldName("备注").setQueryType(buildDefaultQueryType()).setFieldType(QueryFieldType.INPUT),
                new CrmClueCondition().setField("contact_last_content").setFieldName("上次跟进内容").setQueryType(buildDefaultQueryType()).setFieldType(QueryFieldType.INPUT),
                new CrmClueCondition().setField("area_id").setFieldName("所在地").setQueryType(buildDefaultQueryType2()).setFieldType(QueryFieldType.AREA),
                new CrmClueCondition().setField("detail_address").setFieldName("详细地址").setQueryType(buildDefaultQueryType()).setFieldType(QueryFieldType.INPUT),
                // 状态类 true 是, false 否
                new CrmClueCondition().setField("ai_summary").setFieldName("AI摘要标签").setQueryType(buildEQQueryType()).setQueryOptions(MapUtil.builder().put("高", "高意向").put("中", "中意向").put("低", "低意向").build()).setFieldType(QueryFieldType.SELECT),
                new CrmClueCondition().setField("follow_up_status").setFieldName("跟进状态").setQueryType(buildEQQueryType()).setQueryOptions(MapUtil.builder().put(true, "已跟进").put(false, "未跟进").build()).setFieldType(QueryFieldType.SELECT),
                new CrmClueCondition().setField("data_type").setFieldName("资源类型").setQueryType(buildEQQueryType()).setQueryOptions(MapUtil.builder().put(10, "自建").put(20, "公海领取").put(30, "公海分配").put(40, "转移给我").build()).setFieldType(QueryFieldType.SELECT),
                // 模块id
                new CrmClueCondition().setField("module_id").setFieldName("所属模块").setQueryType(buildEQQueryType()).setFieldType(QueryFieldType.MODULE),
                // 负责人
                new CrmClueCondition().setField("owner_user_id").setFieldName("负责人").setQueryType(buildDefaultQueryType2()).setQueryOptions(userIdNameList).setFieldType(QueryFieldType.SELECT),
                // 时间类型
                new CrmClueCondition().setField("create_time").setFieldName("创建时间").setQueryType(buildRangeQueryType()).setFieldType(QueryFieldType.TIME),
                new CrmClueCondition().setField("owner_time").setFieldName("领取时间").setQueryType(buildRangeQueryType()).setFieldType(QueryFieldType.TIME),
                new CrmClueCondition().setField("contact_last_time").setFieldName("上次跟进时间").setQueryType(buildRangeQueryType()).setFieldType(QueryFieldType.TIME),
                new CrmClueCondition().setField("contact_next_time").setFieldName("下次联系时间").setQueryType(buildRangeQueryType()).setFieldType(QueryFieldType.TIME),
                new CrmClueCondition().setField("last_call_time").setFieldName("上次外呼时间").setQueryType(buildRangeQueryType()).setFieldType(QueryFieldType.TIME),
                new CrmClueCondition().setField("last_accept_time").setFieldName("上次接通时间").setQueryType(buildRangeQueryType()).setFieldType(QueryFieldType.TIME),
                new CrmClueCondition().setField("into_pool_time").setFieldName("掉入公海时间").setQueryType(buildRangeQueryType()).setFieldType(QueryFieldType.TIME),
                // 数值类型
                new CrmClueCondition().setField("call_count").setFieldName("外呼次数").setQueryType(buildRangeQueryType()).setFieldType(QueryFieldType.NUMBER),
                new CrmClueCondition().setField("accept_count").setFieldName("接通次数").setQueryType(buildRangeQueryType()).setFieldType(QueryFieldType.NUMBER),
                // 行业 -> todo
                // 客户级别
                new CrmClueCondition().setField("level_id").setFieldName("客户级别").setQueryType(buildDefaultQueryType()).setFieldType(QueryFieldType.LEVEL),
                // 标签
                new CrmClueCondition().setField("label_id").setFieldName("标签").setQueryType(buildDefaultQueryType()).setFieldType(QueryFieldType.LABEL)
        );
    }
}
